﻿
@{
    ViewBag.Title = "收费大类";
    Layout = "~/Views/Shared/_Index.cshtml";
}

<style>
    body {
        background: #DFC2F2;
        background-image: linear-gradient( 135deg, #d5b1f8 10%, #a49cf2 100%);
        background-attachment: fixed;
        background-size: cover;
        /*color:#3dd73c*/
    }
</style>
<div class="topPanel">
    <div class="toolbar">
        <div class="btn-group">
            <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
        </div>
        <div class="btn-group">
            <a class="btn btn-primary" onclick="btn_edit()"><i class="fa fa-pencil-square-o"></i>修改</a>
        </div>
    </div>
    <div class="search">
        <table>
            <tr>
                <td>
                    <div class="input-group">
                        <input id="txt_keyword" type="text" class="form-control" placeholder="收费项目代码/收费项目名称" style="width: 180px;">
                        <span class="input-group-btn">
                            <button id="btn_search" type="button" class="btn btn-primary"><i class="fa fa-search"></i></button>
                        </span>
                    </div>
                </td>
            </tr>
        </table>
    </div>
</div>
<div class="gridPanel">
    <table id="gridList"></table>
    <div id="gridPager"></div>
</div>

<script>
    $(function () {
        GridInit();
    });

    function GridInit() {
        var $gridList = $("#gridList");
        $gridList.dataGrid({
            url: "/RecordManage/MrFeeRel/GetPagintionList",
            autowidth: true,
            height: $(window).height() - 118,
            colModel: [
                { label: "Id", name: "Id", hidden: true },
                { label: "收费项目", name: "sfxm", width: 180, align: 'left' },
                { label: "收费项目名称", name: "sfxmmc", width: 180, align: 'left' },
                { label: "收费大类", name: "feetypecode", width: 180, align: 'left' },
                { label: "收费大类名称", name: "name", width: 180, align: 'left' }
              
            ],
            sortname: "ID desc",
            rowNum: 13,
            pager: "#gridPager",
            viewrecords: true,
            ondblClickRow: function () {
                btn_edit();
            },
        });
        $("#btn_search").click(function () {
            $("#gridList").jqGrid('setGridParam', {
                postData: { keyword: $("#txt_keyword").val() }, page: 1
            }).trigger('reloadGrid');
        });
    }
    

    function btn_edit() {
        var keyValue = $("#gridList").jqGridRowValue().Id;
        //if (!!!keyValue) {
        //    $.modalAlert("请选中一条信息", 'warning');
        //    return false;
        //}
        $.modalOpen({
            id: "updateForm",
            title: "修改收费大类",
            url: "/RecordManage/MrFeeRel/Form?keyValue=" + keyValue,
            width: "500px",
            height: "500px",
            callBack: function (iframeId) {
                $.currentWindow(iframeId).AcceptClick(function () {
                    $("#gridList").resetSelection();
                    $("#gridList").trigger("reloadGrid");
                });
            }
        });
    }
    
</script>